﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using Secure.Service;
using VitaminK.Logging;
using VitaminK.Wcf;
using VitaminK.Wcf.Builders;

namespace Secure.ServiceRunner
{
    class Program
    {
        static void Main(string[] args)
        {
            ILogger logger = new ConsoleLogger();

            ServiceHostBuilder builder = new ServiceHostBuilder();

            using (ServiceHost host = builder.CreateServiceHost(new GatewayServiceDefinition()))
            {
                host.Open();
                Console.ReadLine();
            }
        }
    }

    public class ConsoleLogger : ILogger
    {
        private void WriteMessage(object message)
        {
            Console.WriteLine(message);
        }

        private void WriteMessage(object message, Exception e)
        {
            Console.WriteLine(message);
            Console.WriteLine(e.StackTrace);
        }

        public void Debug(object message)
        {
            WriteMessage(message);
        }

        public void Debug(object message, Exception e)
        {
            WriteMessage(message, e);
        }

        public void Info(object message)
        {
            WriteMessage(message);
        }

        public void Info(object message, Exception e)
        {
            WriteMessage(message, e);
        }

        public void Warn(object message)
        {
            WriteMessage(message);
        }

        public void Warn(object message, Exception e)
        {
            WriteMessage(message, e);
        }

        public void Error(object message)
        {
            WriteMessage(message);
        }

        public void Error(object message, Exception e)
        {
            WriteMessage(message, e);
        }

        public void Fatal(object message)
        {
            WriteMessage(message);
        }

        public void Fatal(object message, Exception e)
        {
            WriteMessage(message, e);
        }
    }
}
